package com.ce.common.widget.arrowbg;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.View;

/**
 * Created by LiLongHui on 2017/7/18.
 */

public class ArrowBgView extends View {


    public ArrowBgView(Context context) {
        super(context);
    }

    public ArrowBgView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    public ArrowBgView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        Paint paint = new Paint();
        paint.setAntiAlias(true);
        paint.setStyle(Paint.Style.FILL);
        paint.setColor(Color.WHITE);
        Path path2 = new Path();
        path2.moveTo(0, getHeight());
        path2.lineTo(getMeasuredWidth()/2, 0);
        path2.lineTo(getMeasuredWidth(), getHeight());
        path2.close();
        canvas.drawPath(path2, paint);

    }
}
